package com.briup.cms.service.impl;

import com.briup.cms.bean.Role;
import com.briup.cms.bean.User;
import com.briup.cms.dao.UserMapper;
import com.briup.cms.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
/**
 * @program: User
 * @description:
 * @author: LiLong
 * @create: 2020-07-02
 **/
@Service
public class UserServiceImpl implements IUserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> findAll() {

        return userMapper.selectAll();
    }
    @Override
    public void saveOrUpdate(User user) {
        if(user.getId()!=null){
            userMapper.update(user);
        } else {
            userMapper.insert(user);
        }
    }

    @Override
    public void deleteById(long id) {
        userMapper.deleteById(id);
    }
}
